home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 19
/
Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso
/
Aminet
/
demo
/
mag
/
trash3_2.lha
/
fuentes
/
FuentesFXC2P.lha
/
FXC2P.Conv_16Col_Cache
< prev
next >
Wrap
Text File
|
1992-09-02
|
8KB
|
351 lines
; En A5 metemos el inicio de donde queremos convertir en PVC
; En A6 metemos el inicio de donde queremos pintar en PFP
; Al final de PlanoX cambiar 10240 y similares para ajustar tamaño
; En d0 y d1 van Ancho (en LONGS) y Alto (PIXELS(BITS))
************************************
**** Plano 1 ***********************
************************************
C2P_Conversion
mulu d1,d0
subq #1,d0
.loop
move.w d0,-(sp)
Moveq #-1,D5 ;Mascara para Bytes Chunky (Plano 1)
; move.l (a5)+,a0 ;Long 1 chunky (pixels 0 - 3)
; move.l (a5)+,a1 ;Long 2 chunky (pixels 4 - 7)
; move.l (a5)+,a2 ;Long 3 chunky (pixels 8 - 11)
; move.l (a5)+,a3 ;Long 4 chunky (pixels 12 - 15)
; move.l (a5)+,a4 ;Long 5 chunky (pixels 16 - 19)
; move.l (a5)+,d4 ;Long 6 chunky (pixels 20 - 23)
; move.l (a5)+,d6 ;Long 7 chunky (pixels 24 - 27)
; move.l (a5)+,d7 ;Long 8 chunky (pixels 28 - 31)
movem.l (a5)+,a0-a4/d4-d7
move.l a0,d0
move.l a1,d2
lsl.l #4,d2
or.l d2,d0
and.l d5,d0
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d0
; 4 0 5 1 6 2 7 3
move.l a2,d1
move.l a3,d2
lsl.l #4,d2
or.l d2,d1
and.l d5,d1
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d1
; 12 8 13 9 14 10 15 11
lsl.l #1,d1
or.l d1,d0
; 00110011001100110011001100110011 -> d0
move.l a4,d1
move.l d4,d2
lsl.l #4,d2
or.l d2,d1
and.l d5,d1
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d1
; 20 16 21 17 22 18 23 19
move.l a6,d3
move.l a7,d2
lsl.l #4,d2
or.l d2,d3
and.l d5,d3
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d3
; 28 24 29 25 30 26 31 27
lsl.l #1,d3
or.l d3,d1
; 00110011001100110011001100110011 -> d1
lsl.l #4,d1
or.l d1,d0 ;d0 = mezcla de todas las longs
; 11111111111111111111111111111111 -> d0
move.l d0,(a6) ;Pintamos 32 pixels de golpe en el Plano 1
; Scrambled X Data:
; (03,11,19,27,07,15,23,31,02,10,18,26,06,14,22,30) (0-15)
; (01,09,17,25,05,13,21,29,00,08,16,24,04,12,20,28) (16-31)
************************************
**** Plano 2 ***********************
************************************
lsl.l #1,d5 ;Mascara para el plano 2
move.l a0,d0
move.l a1,d2
lsl.l #4,d2
or.l d2,d0
and.l d5,d0
lsr.l #1,d0
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d0
; 4 0 5 1 6 2 7 3
move.l a2,d1
move.l a3,d2
lsl.l #4,d2
or.l d2,d1
and.l d5,d1
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00100010001000100010001000100010 -> d1
; 12 8 13 9 14 10 15 11
or.l d1,d0
; 00110011001100110011001100110011 -> d0
move.l a4,d1
move.l d4,d2
lsl.l #4,d2
or.l d2,d1
and.l d5,d1
lsr.l #1,d1
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d1
; 20 16 21 17 22 18 23 19
move.l a6,d3
move.l a7,d2
lsl.l #4,d2
or.l d2,d3
and.l d5,d3
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00100010001000100010001000100010 -> d3
; 28 24 29 25 30 26 31 27
or.l d3,d1
; 00110011001100110011001100110011 -> d1
lsl.l #4,d1
or.l d1,d0 ;d0 = mezcla de todas las longs
; 11111111111111111111111111111111 -> d0
; lea 10240(a6),a6
move.l d0,10240(a6) ;Pintamos 32 pixels de golpe en el Plano 2
************************************
**** Plano 3 ***********************
************************************
lsl.l #1,d5 ;Mascara para el plano 3
move.l a0,d0
move.l a1,d2
lsl.l #4,d2
or.l d2,d0
and.l d5,d0
lsr.l #1,d0
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d0
; 4 0 5 1 6 2 7 3
move.l a2,d1
move.l a3,d2
lsl.l #4,d2
or.l d2,d1
and.l d5,d1
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00100010001000100010001000100010 -> d1
; 12 8 13 9 14 10 15 11
or.l d1,d0
; 00110011001100110011001100110011 -> d0
move.l a4,d1
move.l d4,d2
lsl.l #4,d2
or.l d2,d1
and.l d5,d1
lsr.l #1,d1
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d1
; 20 16 21 17 22 18 23 19
move.l a6,d3
move.l a7,d2
lsl.l #4,d2
or.l d2,d3
and.l d5,d3
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00100010001000100010001000100010 -> d3
; 28 24 29 25 30 26 31 27
or.l d3,d1
; 00110011001100110011001100110011 -> d1
lsl.l #4,d1
or.l d1,d0 ;d0 = mezcla de todas las longs
; 11111111111111111111111111111111 -> d0
; lea 10240(a6),a6
move.l d0,20480(a6) ;Pintamos 32 pixels de golpe en el Plano 3
************************************
**** Plano 4 ***********************
************************************
lsl.l #1,d5 ;Mascara para el plano 4
move.l a0,d0
move.l a1,d2
lsl.l #4,d2
or.l d2,d0
and.l d5,d0
lsr.l #1,d0
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d0
; 4 0 5 1 6 2 7 3
move.l a2,d1
move.l a3,d2
lsl.l #4,d2
or.l d2,d1
and.l d5,d1
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00100010001000100010001000100010 -> d1
; 12 8 13 9 14 10 15 11
or.l d1,d0
; 00110011001100110011001100110011 -> d0
move.l a4,d1
move.l d4,d2
lsl.l #4,d2
or.l d2,d1
and.l d5,d1
lsr.l #1,d1
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00010001000100010001000100010001 -> d1
; 20 16 21 17 22 18 23 19
move.l a6,d3
move.l a7,d2
lsl.l #4,d2
or.l d2,d3
and.l d5,d3
; 00004321000043210000432100004321
; 43210000432100004321000043210000
; 43214321432143214321432143214321
; 00100010001000100010001000100010 -> d3
; 28 24 29 25 30 26 31 27
or.l d3,d1
; 00110011001100110011001100110011 -> d1
lsl.l #4,d1
or.l d1,d0 ;d0 = mezcla de todas las longs
; 11111111111111111111111111111111 -> d0
; lea 10240(a6),a6
move.l d0,30720(a6) ;Pintamos 32 pixels de golpe en el Plano 1
addq.l #4,a6
; lea (-10240*3)+2(a6),a6
move.w (sp)+,d0
dbra d0,.loop
rts
;--------------------------------------------------------------------------------
;Calculo de tiempos en el cache:
;--------------------------------------------------------------------------------
;
; 1 MOVEq para mascara = 1 * 2 = 2 ciclos
; 8 MOVEs ()+,Rn = 8 * 5 = 40 ciclos
; 8 MOVEs Rn,Dn = 8 * 2 = 16 ciclos
; 4 ANDs entre registros = 4 * 2 = 8 ciclos
; 7 LS?s = 7 * 4 = 28 ciclos
; 7 ORs entre registros = 7 * 2 = 14 ciclos
; 1 MOVE Dn,() = = 3 ciclos
; ----
; 111 ciclos
;A partir del segundo plano:
;
; 1 LSL #1,D5 = 1 * 4 = 4 ciclos
; 8 MOVEs Rn,Dn = 8 * 2 = 16 ciclos
; 4 ANDs entre registros = 4 * 2 = 8 ciclos
; 7 LS?s = 7 * 4 = 28 ciclos
; 7 ORs entre registros = 7 * 2 = 14 ciclos
; 1 MOVE Dn,d16() = 1 * 4 = 3 ciclos
; 1 ADDQ = 1 * 2 = 2 ciclos
; dbra = 1 * 6 = 6
; ----
; 79 ciclos
;
;+---------------------------------------------------------------+
;| 1x1 16 colores = (111 + 79 * 3) / 32 = 10.8 ciclos / pixel |
;+---------------------------------------------------------------+